<?php
class DictionaryListModel extends CommonModel{
	
	public function getDictList($flValue,$dictValueField="ITEM_VALUE") {
		$dictionaryListArr = array ();
		$strSql = "select t.id,t.ITEM_KEY,".$dictValueField." as text from ".$this->tablePrefix."dictionary_list as t ,".$this->tablePrefix."dictionary as t1 where t.ITEM_FLID = t1.Id and t1.FL_VALUE='".$flValue."'";
    	$rs = $this->db->query($strSql);
    	return $rs;
	}
	
	public function getDictListFilter($flValue,$xqFilterString,$dictValueField="ITEM_VALUE") {
		$dictionaryListArr = array ();
		$strSql = "select t.id,t.ITEM_KEY,".$dictValueField." as text from ".$this->tablePrefix."dictionary_list as t ,"
				.$this->tablePrefix."dictionary as t1 where t.ITEM_FLID = t1.Id and t1.FL_VALUE='".$flValue."' and t.ITEM_KEY IN(" . $xqFilterString .")";
		$rs = $this->db->query($strSql);
		return $rs;
	}
	

	//根据数据字典值获取字典数据项key
	public function getDictionaryName($flValue,$itemValue){
		$result= array ();
		$strSql = "select dictionary_list.ITEM_KEY as itemKey from smis_dictionary dictionary, smis_dictionary_list dictionary_list where "
				  ." dictionary.Id = dictionary_list.ITEM_FLID and dictionary.FL_VALUE = '".$flValue."' and dictionary_list.ITEM_VALUE = '".$itemValue."'";
		$result = $this->db->query($strSql);
		$itemKey = '';
		if(!empty($result)){
			$itemKey = $result[0]['itemKey'];
		}
		return $itemKey;
	}
	
}